package com.esri.core.tasks.na;

import com.esri.core.internal.tasks.d.f;
import com.esri.core.internal.tasks.e;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.CallbackListener;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

/* loaded from: classes.dex */
public class ServiceAreaTask {
    String _url;
    UserCredentials credentials;

    public ServiceAreaTask(String str) {
        this._url = str;
    }

    public ServiceAreaTask(String str, UserCredentials userCredentials) {
        this._url = str;
        this.credentials = userCredentials == null ? null : userCredentials.getCopy();
    }

    public ServiceAreaParameters getDefaultParameters() throws Exception {
        f fVar = new f(null, this._url, this.credentials);
        ServiceAreaParameters serviceAreaParameters = new ServiceAreaParameters();
        serviceAreaParameters._params = fVar.a();
        return serviceAreaParameters;
    }

    public ServiceAreaResult solve(ServiceAreaParameters serviceAreaParameters) throws Exception {
        return new f(serviceAreaParameters.getParams(), this._url, this.credentials).execute();
    }

    public Future<ServiceAreaResult> solve(final ServiceAreaParameters serviceAreaParameters, final CallbackListener<ServiceAreaResult> callbackListener) {
        return e.c.submit(new Callable<ServiceAreaResult>() { // from class: com.esri.core.tasks.na.ServiceAreaTask.1
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            public ServiceAreaResult call() {
                ServiceAreaResult serviceAreaResult = null;
                try {
                    serviceAreaResult = ServiceAreaTask.this.solve(serviceAreaParameters);
                } catch (Exception e) {
                    CallbackListener callbackListener2 = callbackListener;
                    if (callbackListener2 != null) {
                        callbackListener2.onError(e);
                    }
                }
                if (Thread.currentThread().isInterrupted()) {
                    return serviceAreaResult;
                }
                CallbackListener callbackListener3 = callbackListener;
                if (callbackListener3 != null) {
                    callbackListener3.onCallback(serviceAreaResult);
                }
                return serviceAreaResult;
            }
        });
    }
}
